﻿using DocumentFormat.OpenXml.Lite.Helper;
using DocumentFormat.OpenXml.Lite.WordprocessingML.Word.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Word.SectionProperties
{
    [XmlRoot("pgNumType", Namespace = Constants.WordMain)]
    public class PageNumberingSettings : XmlSerializable, ISectionPropElement
    {
        [Optional]
        [XmlAttribute("fmt", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_NumberFormat> PageNumberFormat { get; set; }

        [Optional]
        [XmlAttribute("start", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> StartingPageNumber { get; set; }

        [Optional]
        [XmlAttribute("chapStyle", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<int> ChapterHeadingStyle { get; set; }

        [Optional]
        [XmlAttribute("chapSep", Namespace = Constants.WordMain, Form = XmlSchemaForm.Qualified)]
        public Nullable<ST_ChapterSep> ChapterSeparator { get; set; }

        public PageNumberingSettings() { }

        public void Copy(object obj)
        {
            if (obj is PageNumberingSettings)
            {
                this.PageNumberFormat = (obj as PageNumberingSettings).PageNumberFormat;
                this.StartingPageNumber = (obj as PageNumberingSettings).StartingPageNumber;
                this.ChapterHeadingStyle = (obj as PageNumberingSettings).ChapterHeadingStyle;
                this.ChapterSeparator = (obj as PageNumberingSettings).ChapterSeparator;
            }
        }
    }
}
